from mediator import mediator
from mediator . tests . test_assistant import make_mediator_test_keyword_args

class gui_fake :
    def __init__ ( self ) :
        self . _received_pop_background_color_args = None
        self . _received_push_background_color_args = None
        self . _received_set_background_color_args = None
    def gui_set_background_color ( self , widget , color ) :
        self . _received_set_background_color_args = [ widget , color ]
    def gui_push_background_color ( self , widget ) :
        self . _received_push_background_color_args = [ widget ]
    def gui_pop_background_color ( self , widget ) :
        self . _received_pop_background_color_args = [ widget ]

class mediator_gui_background_color_tests : 
    'mediator_gui_background_color'
    def __init__ ( self , test ) :
        self . _test = test
        self . _gui = gui_fake ( )
        self . _mediator = mediator ( )
        self . _mediator . register_modules ( ** make_mediator_test_keyword_args \
            ( 'gui' 
            , self . _gui 
            , None
            ) )
    def test_gui_set_background_color ( self ) :
        self . _mediator . gui_set_background_color ( 'my widget' , 'my color' )
        self . _test . assume_equal ( self . _gui . _received_set_background_color_args ,
            [ 'my widget'
            , 'my color'
            ] )
    def test_gui_push_background_color ( self ) :
        self . _mediator . gui_push_background_color ( 'my widget' )
        self . _test . assume_equal ( self . _gui . _received_push_background_color_args ,
            [ 'my widget'
            ] )
    def test_gui_pop_background_color ( self ) :
        self . _mediator . gui_pop_background_color ( 'my widget' )
        self . _test . assume_equal ( self . _gui . _received_pop_background_color_args ,
            [ 'my widget'
            ] )
